import loopService from './loopService'
import lifeCycle from './lifeCycle'
import BtnEnum from './BtnEnum';
export default ({ dispatch, index, actionConfig = {} }: any) => {
  return async () => {
    const errors = await (async () => {
      // validate
      const validateErrors = lifeCycle({
        dispatch,
        action: actionConfig?.validate,
      });
      return validateErrors;
    })();

    const actionResult = loopService({
      dispatch,
      index,
      actionConfig,
    })

    return null
  }
};
